//
//  TableController.h
//  TianyaGuest
//
//  Created by liuwenyang on 14-8-19.
//  Copyright (c) 2014年 liuwenyang. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "TableViewCell.h"


@class TableController;

@protocol TableControllerDelegate <NSObject>

@optional
- (void)modelDidLoadFinished:(TableController *)controller;
- (void)didSelectedCell:(TableController *)controller dataSrc:(id)dataSrc row:(NSInteger)row;
- (void)didSelectedCell:(TableController *)controller tableViewCell:(TableViewCell  *)tableViewCell;
- (void)didDeleteCell:(TableController *)controller dataSrc:(id)dataSrc;
- (void)didClickCellSubView:(TableController *)tableController subView:(id)subView subViewData:(id)subViewData;
@end

@interface TableController : NSObject <UITableViewDataSource, UITableViewDelegate, TableViewCellDelegate>
//{
//    id<TableControllerDelegate>__unsafe_unretained delegate_;
////    __unsafe_unretained UIViewController* viewController_;
//    
//    UITableView* tableView_;
//    //数据源
//    NSMutableArray* listArray_;
//    NSNumber* listTotal_;
//}
@property (nonatomic, weak) id<TableControllerDelegate> delegate;
@property (nonatomic, strong) UITableView* tableView;
@property (nonatomic, strong) NSNumber* listTotal;
@property (nonatomic, strong) NSMutableArray *listArray;
@property (nonatomic, assign) Class classForCell;

//初始化
- (id)initWithFrame:(CGRect)frame;
- (id)initWithAutoLayout;
- (id)initWithClassForCell:(Class)classForCell;
//tableviewcell
//- (Class)cellClassForTableView;
////返回table数据源
//- (NSArray *)tableDataSource;


@end


//加了刷新机制的tablecontroller
@interface RefreshTableController : TableController

@property (nonatomic, assign) NSInteger pageIndex;

@property (nonatomic, assign) NSInteger totalCount;

//- (id)initWithViewController:(UIViewController *)viewController
//             withDragRefresh:(BOOL)enableDragRefresh
//          withInfiniteScroll:(BOOL)enableInfiniteScroll;

//- (id)initWithFrame:(CGRect)frame delegate:(id<TableControllerDelegate>)delegate withDragRefresh:(BOOL)enableDragRefresh withInfiniteScroll:(BOOL)enableInfiniteScroll;

//- (id)initWithFrame:(CGRect)frame withDragRefresh:(BOOL)enableDragRefresh withInfiniteScroll:(BOOL)enableInfiniteScroll;

//- (id)initWithDragRefresh:(BOOL)enableDragRefresh withInfiniteScroll:(BOOL)enableInfiniteScroll;

- (id)initWithDragRefresh:(BOOL)enableDragRefresh withInfiniteScroll:(BOOL)enableInfiniteScroll classForCell:(Class)classForCell;

- (id)initWithDragRefresh:(BOOL)enableDragRefresh withInfiniteScroll:(BOOL)enableInfiniteScroll classForCell:(Class)classForCell refreshHeaderType:(NSInteger)refreshHeaderType;


- (void)refreshTable:(void (^)(BOOL finished))block;
- (void)getTableMore:(void (^)(BOOL finished))block;

//强制模拟下拉刷新
- (void)forceRefresh;

//强制刷新不带下拉效果
-(void)forceRefreshWithoutAnimation;

@end















